// import childProcess from 'child_process'
const childProcess = require('child_process');

const exec = childProcess.exec;

// nextjs 容器 47.94.165.185:16500/
const dockerImage = "47.94.165.185:16500/shzn-website";
const tag = "latest";
const build = `docker build -f ./Dockerfile -t ${dockerImage} .`;
const push = `docker push ${dockerImage}`;

console.log('开始创建 nextjs 镜像...');
exec(build, (err, stdout, stderr) => {
  if (err) {
    console.log(err);
  } else {
    console.log("@@Build : ", "Build image success!");
    console.log('开始推送镜像...');
    exec(push, (err, stdout, stderr) => {
      if (err) {
        console.log(err);
      } else {
        console.log('@@Push : Push image success!');
      }
    });
  }
});

